package com.my.serviceimpl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.my.bean.EmployeeFile;
import com.my.bean.ResultPage;
import com.my.bean.VoPage;
import com.my.mapper.EmployeeFileMapper;
import com.my.service.EmployeeFileService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 员工档案管理 服务实现类
 * </p>
 *
 * @author 冯政尚
 * @since 2018-08-29
 */
@Service
public class EmployeeFileServiceImpl extends ServiceImpl<EmployeeFileMapper, EmployeeFile> implements EmployeeFileService {


    //baseMap是mybatis封装的一个mapper直接调用就行你用在注入mapper了
    //查询
    /*@Override
    public List<EmployeeFile> select() {
        return baseMapper.select();
    }*/

    //实现分页查询
    @Override
    public ResultPage<EmployeeFile> selectMyPage(Map map, VoPage voPage, long areaid,boolean admin) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("page", (voPage.getPage() - 1)*voPage.getLimit());
        paramMap.put("limit", voPage.getLimit());
        List<EmployeeFile> list = baseMapper.selectMyPage(map,paramMap,areaid,admin);
        Integer count = baseMapper.countMyPage(map,paramMap,areaid,admin);
        ResultPage<EmployeeFile> resultPage=new ResultPage<>();
        resultPage.setCode(0);
        resultPage.setCount(count);
        resultPage.setMsg("成功");
        resultPage.setData(list);
        return resultPage;
    }



}
